<template>
	<view class="datamodule">
		<view class="datadate">
			<view class="content_date">
				<view style="width: 140rpx;"></view>
				<view class="date_title">今日实时看板</view>
				<view class="date_select">
					<picker mode="selector" :range="picker.pickerArr" @change="pickerSel($event)">
						<text>{{picker.pickerTarget}}</text>
						<image src="../../static/img/ic_pulldown.png"></image>
					</picker>
				</view>
			</view>
		</view>
		<!-- 总览模块 -->
		<view class="contentModule contentZl">
			<view class="module_list">
				<view class="module_listinc">
					<view class="module_listtop">
						<text>拉新转化</text>
					</view>
					<view class="zl_listcon">
						<view class="zl_listeve">
							<view class="zl_listval">{{res.newshop.basic_shop.new_num}}<text>户</text></view>
							<view class="zl_listname">新增支付门店</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{res.newshop.waimai_shop.new_num}}<text>户</text></view>
							<view class="zl_listname">新增外卖门店</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{res.newusers.new.num}}/{{res.newusers.conversion.num}}<text>人</text></view>
							<view class="zl_listname">新增/转化用户</view>
						</view>
					</view>
				</view>
				<view class="module_listinc">
					<view class="module_listtop">
						<text>支付订单</text>
					</view>
					<view class="zl_listcon">
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(res.payorders.num).taika_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(res.payorders.payment).taika_money}}</view>
							<view class="zl_listname">台卡订单</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(res.payorders.num).tangshi_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(res.payorders.payment).tangshi_money}}</view>
							<view class="zl_listname">扫码点餐</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(res.payorders.num).scan_qr_buy_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(res.payorders.payment).scan_qr_buy_money}}</view>
							<view class="zl_listname">扫码购</view>
						</view>
					</view>
				</view>
				<view class="module_listinc">
					<view class="module_listtop">
						<text>外卖订单</text>
					</view>
					<view class="zl_listcon">
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(res.waimaiorders.num).self_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(res.waimaiorders.payment).self_payment}}</view>
							<view class="zl_listname">自取</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(res.waimaiorders.num).shop_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(res.waimaiorders.payment).shop_payment}}</view>
							<view class="zl_listname">自配送</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(res.waimaiorders.num).platform_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(res.waimaiorders.payment).platform_payment}}</view>
							<view class="zl_listname">平台配送</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "datamodule0",
		data() {
			return {
				picker:{ //选择器数据
					pickerArr:['全部数据','我的数据'],
					pickerTarget:'全部数据',
					checkType:1
				}
			};
		},
		props:{
			res:{
				type:Object,
				default(){
					return {
						newshop: {
							basic_shop: {
								"total_num": 0,
								"new_num": 0,
								"flag": 0,
								"d2d": 0
							},
							waimai_shop: {
								"total_num": 0,
								"new_num": 0,
								"flag": 0,
								"d2d": 0
							}
						},
						newusers: {
							total_num: 0,
							new: {
								"num": 0,
								"flag": 0,
								"d2d": 0
							},
							conversion: {
								"num": 0,
								"flag": 0,
								"d2d": 0
							}
						},
						waimaiorders: {
							"payment": {
								"total_payment": 0,
								"self_payment": 0,
								"shop_payment": 0,
								"platform_payment": 0,
								"flag": 0,
								"d2d": 0
							},
							num: {
								"total_num": "0",
								"self_num": "0",
								"shop_num": "0",
								"platform_num": "0",
								"flag": 0,
								"d2d": 0
							}
						},
						payorders: {
							"payment": {
								"total_payment": 0,
								"tangshi_money": 0,
								"scan_qr_buy_money": 0,
								"taika_money": 0,
								"flag": 0,
								"d2d": 0
							},
							"num": {
								"total_num": 0,
								"tangshi_num": 0,
								"scan_qr_buy_num": 0,
								"taika_num": 0,
								"flag": 0,
								"d2d": 6
							}
						}
					}
				}
				
			},
		},
		methods:{
			pickerSel:function(e){
				this.picker.pickerTarget = this.picker.pickerArr[e.detail.value];
				this.picker.checkType = e.detail.value+1;
				this.refreshDataEmit();
			},
			//刷新当前页面的数据
			refreshDataEmit:function(){
				this.$emit('refreshData',{
					type:'Md',
					data:{
						data_type:4,
						check_type:this.picker.checkType, //全部/我的数据
						seachtime:this.timeStatus[this.dateIndex]  //时间
					}
				})
			},
			isEmpty:function(num){
				return num?num:{}
			}
		},
		components: {
		}
	}
</script>

<style lang="scss" scoped>
	@import './datamodule.scss';
	
</style>
